package com.example.user.biz.domain.dto;

import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AddAddressDTO {
    @NotBlank(message = "收货人姓名不能为空")
    @Size(min = 2, max = 20, message = "收货人姓名长度需在2-20个字符之间")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z·]+$", message = "收货人姓名只能包含中文、英文和间隔号")
    private String receiver;

    @NotBlank(message = "联系方式不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$",
            message = "请输入有效的手机号或固话（格式：手机号或区号-号码）")
    private String contact;

    @NotBlank(message = "省市区信息不能为空")
    @Size(min = 5, max = 100, message = "省市区信息长度需在5-100个字符之间")
    private String fullLocation;

    @NotBlank(message = "省份编码不能为空")
    @Pattern(regexp = "^\\d{6}$", message = "省份编码必须为6位数字")
    private String provinceCode;

    @NotBlank(message = "城市编码不能为空")
    @Pattern(regexp = "^\\d{6}$", message = "城市编码必须为6位数字")
    private String cityCode;

    @NotBlank(message = "区县编码不能为空")
    @Pattern(regexp = "^\\d{6}$", message = "区县编码必须为6位数字")
    private String countyCode;

    @NotBlank(message = "详细地址不能为空")
    @Size(min = 5, max = 255, message = "详细地址长度需在5-255个字符之间")
    private String address;

    @NotNull(message = "默认状态不能为空")
    @Min(value = 0, message = "默认状态值不合法")
    @Max(value = 1, message = "默认状态值不合法")
    private Integer isDefault;
}
